package com.gz.droolsrule.pojo.fact;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ClassName: RuleExecutionObject <br/>
 * Description: 封装规则全局传参对象 <br/>
 * date: 2019/5/29 14:42<br/>
 *
 * @author gz<br />
 * @since JDK 1.8
 */
@Data
public class RuleExecutionObject implements Serializable {
    // fact集合
    private List<Object> factObjectList = new ArrayList<Object>();
    // 全局对象集合
    private Map<String,Object> globalMap = new HashMap<String,Object>();
    // 是否全部执行
    private boolean executeAll = true;
    // 根据名称过滤要执行的规则
    private String ruleName;

    /**
     * 添加fact对象
     * @param factObject
     */
    public void addFactObject(Object factObject){
        this.factObjectList.add(factObject);
    }

    /**
     * 设置global参数
     * @param key
     * @param val
     */
    public void setGlobal(String key,Object val){
        this.globalMap.put(key,val);
    }

}
